package com.upcode.weighing.vo.req.pc;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper=false)
public class CorporateTransferPayAddReqVo {

    /**
     * 补费单位名称
     */
    private String companyName;
    /**
     * 回执单单号
     */
    private String receiptNo;
    /**
     * 补缴金额
     */
    private BigDecimal supplementaryAmount;

    /**
     * 转账日期
     */
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime transferTime;

    /**
     * 回执单附件ID,多个用逗号隔开
     */
    private String receiptFileIds;
    /**
     * 登记人姓名
     */
    private String registrantName;
    /**
     * 短信验证码
     */
    private String msgCode;

    public String checkParams(){
        if(StringUtils.isBlank(companyName)){
            return "请输入补费单位名称";
        }
        if(StringUtils.isBlank(receiptNo)){
            return "请输入回执单单号";
        }
        if(null == supplementaryAmount || supplementaryAmount.doubleValue() <= 0 ){
            return "补费金额不可为空或者小于等于0";
        }
        if(null == transferTime){
            return "请选择转账日期";
        }
        if(StringUtils.isBlank(receiptFileIds)){
            return "请上传回执单附件";
        }
        if(receiptFileIds.split(",").length > 5){
            return "回执单附件最多5张";
        }
        if(StringUtils.isBlank(registrantName)){
            return "请输入登记人姓名";
        }
        if(StringUtils.isBlank(msgCode)){
            return "请输入短信验证码";
        }
        return null;
    }
}
